from flask import Blueprint
from .models import User
from ibm import db, render_template, redirect, request, url_for, session, \
    flash
from sqlalchemy import and_
index = Blueprint('index', __name__)



@index.route('/')
def index_():
    user_id = session.get('user_id')
    if user_id is None:
        flash('未登录，请登录')
        return redirect(url_for('login.login_get'))
    else:
        id = session.get('user_id')
        user = User.query.filter(User.user_id == id).first()
        return render_template('index.html',user=user)

